# -- coding: utf-8 -- 
# Name: 0101
import socket

def get_this_info():
    # 这是设备名
    my_host = socket.gethostname()
    # 这是设备名对应的IPv4地址
    my_ip = socket.gethostbyname(my_host)
    print my_host + "  --  " + my_ip
    return my_host,my_ip

def get_remote_info():
    host = "http://www.qq.com"
    try:
        # 尝试获取远程主机的IP地址
        print socket.gethostbyname(host)
    except Exception,e:
        # 若出错，则打印错误信息
        print host + "  " + str(e)



